From e6921e65655ec1d6b028ac362fe1f8a36103dc2f Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Wed, 18 Aug 2004 17:09:00 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.81 (41238d2cHqbklCcCkVBI3g3Q45Y0dg) Fix dom_mem_op properly. :-) --- xen/common/dom_mem_ops.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/common/dom_mem_ops.c b/xen/common/dom_mem_ops.c index 1f61c240fa..483097f261 100644 --- a/xen/common/dom_mem_ops.c +++ b/xen/common/dom_mem_ops.c @@ -98,8 +98,11 @@ long do_dom_mem_op(unsigned int op, struct domain *d; long rc; - d = ( (domid == DOMID_SELF) || (!IS_PRIV(current)) ) ? current : find_domain_by_id(domid); - if ( d == NULL ) + if ( likely(domid == DOMID_SELF) ) + d = current; + else if ( unlikely(!IS_PRIV(current)) ) + return -EPERM; + else if ( unlikely((d = find_domain_by_id(domid)) == NULL) ) return -ESRCH; switch ( op ) @@ -115,7 +118,7 @@ long do_dom_mem_op(unsigned int op, break; } - if ( domid != DOMID_SELF ) + if ( unlikely(domid != DOMID_SELF) ) put_domain(d); return rc; -- 2.30.2